﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WCLOnlineExam.Models;

namespace WCLOnlineExam.Controllers
{
    [EntityAuthorize]
    public class HomeController : EntityController
    {
        
        public HomeController(IEntityContextBuilder builder)
            : base(builder)
        {
        }
        //
        // GET: /Home/

        public ActionResult Index()
        {
            //return RedirectToAction("UserCenter", "Student");
            if (Session["user"] == null)
            {
                return RedirectToRoute(new { controller = "Account", action = "Login" });
            }
            else
            {
                return RedirectToAction("UserCenter", "Student");
            }
        }

        public ActionResult StartExam()
        {
            return View();
        }
        //public ActionResult install()
        //{
        //    var groupContext = EntityBuilder.GetContext<UserGroup>();
        //    UserGroup userGroup= new UserGroup();
        //    userGroup.Name = "天才一班";
        //    userGroup.Power = UserPower.Student;
        //    userGroup.Name = "天才一班";

        //    groupContext.Add(userGroup);
        //    return RedirectToRoute(new { controller = "Account", action = "Login" }); 
        //}
    }
}
